#ifndef CRC_H
#define CRC_H

#include <QObject>

#include "CommonTypes.h"

class CRC : public QObject
{
    Q_OBJECT
public:
    explicit CRC(QObject *parent = nullptr);

    static quint16 CRC_16(quint8 * pFrame, quint16 len);
    static quint16 CRC_16(QByteArray array, quint16 len);

    static uint8_t Calculate_CS(uint8_t *pFrame, uint16_t len);
    static uint8_t Calculate_CS(QByteArray Array, uint16_t len);

    static QByteArray GenerateRequestFrame(quint16 startAddress, CommonEnum::RegisterOperatorType optType = CommonEnum::OptRead, quint16 val = 0x00);


signals:
};

#endif // CRC_H
